/**
 * Created by 万林 on 2016/9/14 0014.
 */
function getCurentStyle(obj,styleName){
    if (getComputedStyle(obj)){
        return parseFloat(getComputedStyle(obj)[styleName]);
    }else {
        return parseFloat(obj.currentStyle[styleName]);
    }
}
function getElementsByClassName(oParent,sClass) {
    var aResult = [];
    var aEle = oParent.getElementsByTagName('*');
    for(var i = 0;i<aEle.length;i++){
        if (aEle[i].className == sClass){
            aResult.push(aEle[i]);
        }
    }
    return aResult;
}
function  AnimatedObjEasyinout(obj,json,callBackFunction) {
        clearInterval(obj.BSK_Animation_timer);
    obj.BSK_Animation_timer = setInterval(function () {
        var bStop = true;
        for(var attr in json){
            var curentValue = Math.round(getCurentStyle(obj,attr+""));
            var speed = (json[attr+""]-curentValue)/6;
            speed = speed>0?Math.ceil(speed):Math.floor(speed);
            if (curentValue!=json[attr+""]){
               bStop = false;
            }
            obj.style[attr+""] = (curentValue+speed) + "px";

        }
        if (bStop){
            clearInterval(obj.BSK_Animation_timer);
            if (callBackFunction){
                callBackFunction();
                callBackFunction = null;
            }
        }
    },30);
}
function pad(num, n) {
    return (Array(n).join(0) + num).slice(-n);
}
function getPosition(even) {
    var scroTop = document.documentElement.scrollTop||document.body.scrollTop;
    var scroLeft = document.documentElement.scrollLeft||document.body.scrollLeft;
    return {x:even.clientX+scroLeft,y:even.clientY+scroTop};
}

function rotate(obj,value)
{
    obj.style.webkitTransform="rotate(" + value + "deg)";
    obj.style.msTransform="rotate(" + value + "deg)";
    obj.style.MozTransform="rotate(" + value + "deg)";
    obj.style.OTransform="rotate(" + value + "deg)";
    obj.style.transform="rotate(" + value + "deg)";
}

function BSKObj(id) {
    return document.getElementById(id);
}